//
//  AboutViewController.swift
//  ball_lion
//
//  Created by moon on 2024/10/30.
//

import UIKit
import SnapKit

class AboutViewController: UIViewController {

    var imageView: UIImageView = {
        var imageView = UIImageView(frame: CGRect(x: 100, y: 100, width: 60, height: 60))
        return imageView
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        if let appIconName = getAppIconName() {
            print("App Icon Name: \(appIconName)")
            imageView.image = UIImage (named: appIconName)
        }
        view.addSubview(imageView);
        imageView.snp.makeConstraints { make in
            make.center.equalTo(self.view)
            make.width.height.equalTo(80);
        }
    }

    func getAppIconName() -> String? {
        guard let bundleInfo = Bundle.main.infoDictionary,
              let icons = bundleInfo["CFBundleIcons"] as? [String: Any],
              let primaryIcons = icons["CFBundlePrimaryIcon"] as? [String: Any],
              let iconFiles = primaryIcons["CFBundleIconFiles"] as? [String],
              let iconName = iconFiles.first else {
            return nil
        }
        return iconName
    }

}

